<template>
  <div>
    <h1>app</h1>
    <hr/>
    <!-- 父组件 使用属性传递 -->
    <child :username="username" @onSetname="onSetname"></child>
    <hr/>
     <child :username="username"></child>
     <hr/>
     <button @click="addLoading">点击加载</button>
  </div>
</template>

<script>
//引入子组件
import child from './components/Child.vue'
  export default {
    
    //注册
    components:{
      child
    },
    data() {
      return {
        username:'admin'
      }
    },
    methods: {
      onSetname(value){
        this.username = value
      },
      addLoading(){
        
        this.$loading('loading...')
      }
    },
  }
</script>

<style lang="scss" scoped>

</style>